﻿using FreeSql.DataAnnotations;
using Jumei.Common.BaseModel;
using System;

namespace Jumei.Model.Business.GoodsManage
{
    /// <summary>
    /// 商品表
    /// </summary>
    [Table(Name = "gd_goods")]
    [Index("idx_{tablename}_01", nameof(GoodsSn), true)]
    [Index("idx_{tablename}_02", nameof(ProductNo), false)]
    [Index("idx_{tablename}_03", nameof(GoodsName), false)]
    public class GoodsEntity : EntityFull, ITenant
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Column(Position = -10)]
        public long? TenantId { get; set; }

        /// <summary>
        /// 商品编号
        /// </summary>
        [Column(StringLength = 20)]
        public string GoodsSn { get; set; }

        /// <summary>
        /// 商品货号
        /// </summary>
        [Column(StringLength = 20)]
        public string ProductNo { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        [Column(StringLength = 200)]
        public string GoodsName { get; set; }

        /// <summary>
        /// 商品图片
        /// </summary>
        [Column(StringLength = 200)]
        public string GoodsImg { get; set; }

        /// <summary>
        /// 店铺ID
        /// </summary>
        public long ShopId { get; set; }

        /// <summary>
        /// 市场价
        /// </summary>
        public decimal MarketPrice { get; set; }

        /// <summary>
        /// 店铺价
        /// </summary>
        public decimal ShopPrice { get; set; }

        /// <summary>
        /// 预警库存
        /// </summary>
        public int WarnStock { get; set; }

        /// <summary>
        /// 商品总库存
        /// </summary>
        public int GoodsStock { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        [Column(StringLength = 10)]
        public string GoodsUnit { get; set; }

        /// <summary>
        /// 促销信息
        /// </summary>
        [Column(StringLength = -2)]
        public string GoodsTips { get; set; }

        /// <summary>
        /// 是否上架
        /// </summary>
        public bool IsSale { get; set; } = true;

        /// <summary>
        /// 是否精品
        /// </summary>
        public bool IsBest { get; set; } = false;

        /// <summary>
        /// 是否热销产品
        /// </summary>
        public bool IsHot { get; set; } = false;

        /// <summary>
        /// 是否新品
        /// </summary>
        public bool IsNew { get; set; } = false;

        /// <summary>
        /// 是否推荐
        /// </summary>
        public bool IsRecom { get; set; } = false;

        /// <summary>
        /// 商品分类ID路径  catId1_catId2_catId3
        /// </summary>
        [Column(StringLength = 255)]
        public string GoodsCatIdPath { get; set; }

        /// <summary>
        /// 最后一级商品分类ID	
        /// </summary>
        public long GoodsCatId { get; set; }

        /// <summary>
        /// 门店商品分类第一级ID
        /// </summary>
        public long ShopCatId1 { get; set; }

        /// <summary>
        /// 门店商品第二级分类ID
        /// </summary>
        public long ShopCatId2 { get; set; }

        /// <summary>
        /// 品牌Id
        /// </summary>
        public long BrandId { get; set; }

        /// <summary>
        /// 商品描述
        /// </summary>
        [Column(StringLength = -2)]
        public string GoodsDesc { get; set; }

        /// <summary>
        /// 商品状态 
        /// </summary>
        public GoodsStatusType GoodsStatus { get; set; } = 0;

        /// <summary>
        /// 总销售量
        /// </summary>
        public int SaleNum { get; set; }

        /// <summary>
        /// 上架时间
        /// </summary>
        public DateTime SaleTime { get; set; }

        /// <summary>
        /// 访问数
        /// </summary>
        public int VisitNum { get; set; }

        /// <summary>
        /// 评价数
        /// </summary>
        public int AppraiseNum { get; set; }

        /// <summary>
        /// 是否有规格
        /// </summary>
        public bool IsSpec { get; set; }

        /// <summary>
        /// 商品相册
        /// </summary>
        [Column(StringLength = -2)]
        public string Gallery { get; set; }

        /// <summary>
        /// 商品SEO关键字
        /// </summary>
        [Column(StringLength = 200)]
        public string GoodsSeoKeywords { get; set; }

        /// <summary>
        /// 状态说明
        /// 一般用于说明拒绝原因
        /// </summary>
        [Column(StringLength = 255)]
        public string IllegalRemarks { get; set; }

        /// <summary>
        /// 启用
        /// </summary>
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 商品类型
        /// 0:实物商品 
        /// 1:虚拟商品
        /// </summary>
        public int GoodsType { get; set; }

        /// <summary>
        /// 是否分销商品
        /// </summary>
        public bool IsDistribut { get; set; }

        /// <summary>
        /// 分销佣金
        /// </summary>
        public decimal Commission { get; set; }

        /// <summary>
        /// 是否包邮
        /// </summary>
        public bool IsFreeShipping { get; set; } = false;

        /// <summary>
        /// 商品关键字搜索
        /// 该字段内容由系统生成，取商品名称+属性内容
        /// </summary>
        [Column(StringLength = -2)]
        public string GoodsSerachKeywords { get; set; }

        /// <summary>
        /// 商品视频
        /// </summary>
        [Column(StringLength = 150)]
        public string GoodsVideo { get; set; }

        /// <summary>
        /// 成本价
        /// </summary>
        public decimal CostPrice { get; set; }

        /// <summary>
        /// 视频缩略图
        /// </summary>
        [Column(StringLength = 150)]
        public string GoodsVideoThumb { get; set; }

        /// <summary>
        /// 商品SEO描述
        /// </summary>
        [Column(StringLength = 600)]
        public string GoodsSeoDesc { get; set; }

        /// <summary>
        /// 计价方式
        /// </summary>
        [Column(StringLength = 600)]
        public ShippingFeeType ShippingFeeType { get; set; }

        /// <summary>
        /// 商品重量
        /// </summary>
        public decimal GoodsWeight { get; set; }

        /// <summary>
        /// 商品体积
        /// </summary>
        public decimal GoodsVolume { get; set; }

        /// <summary>
        /// 店铺快递公司ID	
        /// </summary>
        public long ShopExpressId { get; set; }

        /// <summary>
        /// 是否属于批发商品
        /// </summary>
        public bool IsWholesale { get; set; } = false;

        /// <summary>
        /// 收藏该商品的人数	
        /// </summary>
        public int CollectNum { get; set; }
    }
}
